/*
 * The contents of this file are subject to the Mozilla Public License Version
 * 1.1 (the "License"); you may not use this file except in compliance with the
 * License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
 * 
 * Software distributed under the License is distributed on an "AS IS" basis,
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
 * the specific language governing rights and limitations under the License.
 * 
 * The Original Code is SemanticTurkey.
 * 
 * The Initial Developer of the Original Code is University of Roma Tor Vergata.
 * Portions created by University of Roma Tor Vergata are Copyright (C) 2007.
 * All Rights Reserved.
 * 
 * SemanticTurkey was developed by the Artificial Intelligence Research Group
 * (art.uniroma2.it) at the University of Roma Tor Vergata (ART) Current
 * information about SemanticTurkey can be obtained at
 * http://semanticturkey.uniroma2.it
 * 
 */
/**NScarpato 28/05/2008*/

 if (typeof art_semanticturkey == 'undefined') var art_semanticturkey = {};

 art_semanticturkey.range_highlightSearchTermsPosition = function(contentDocument,rangeStr,id,qName)  
{	
	try { 
 	   xptrService = Components.classes["@mozilla.org/xpointer-service;1"].getService(); 
 	   xptrService = xptrService.QueryInterface(Components.interfaces.nsIXPointerService); 
    } 
     catch (e) { 
        window.alert("In order to create XPointer fragment identifiers, you must install the " + 
                     "javascript XPointer Service component, available at xpointerlib.mozdev.org/installation.html"); 
 	        return null; 
 	    } 
	var range = xptrService.parseXPointerToRange(rangeStr, contentDocument);
	surroundTag=contentDocument.createElement("font");
	surroundTag.setAttribute("style","color:blue; background-color:yellow;");
	surroundTag.setAttribute("annId",id);
	surroundTag.setAttribute("qName",qName);
	range.surroundContents(surroundTag);
 	return true;
};

